package com.ycc.controller;

import com.ycc.pojo.Content;
import com.ycc.service.impl.ContentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.*;

//商品详情，商品controller
@Controller
public class IndexController {
    @Autowired
    private ContentServiceImpl contentService;

    @RequestMapping("/detail/{id}")
    public String detailIntroduceOfGood(@PathVariable("id")String id,ModelMap modelMap){
        //查询id为此的商品，并传到前端
        Content content =(Content) contentService.selectById(id);
        List<Content> list=new ArrayList<>();
        list.add(content);
        modelMap.addAttribute("good",list);
        list.forEach(System.out::println);
        return "watch";
    }
}
